#include "Listing_20.2_LinkedList.h"
#include <iostream>

using namespace std;

int main()
{

  LinkedList linkedList;

  //Add a Node, which value is 1 to linkedlist's head. <1>
  Node *node = new Node(1);
  linkedList.addFirst(node);
  cout << "linkedList.getFirst()->getValue() = " << linkedList.getFirst()->getValue() << endl;
  cout << "linkedList.getLast()->getValue() = " << linkedList.getLast()->getValue() << endl;

  //Add a Node, which value is 10 to linkedlist's head. <10, 1>
  node = new Node(10);
  linkedList.addFirst(node);
  cout << "linkedList.getFirst()->getValue() = " << linkedList.getFirst()->getValue() << endl;
  cout << "linkedList.getLast()->getValue() = " << linkedList.getLast()->getValue() << endl;
  
  //Add a Node, which value is 5 to linkedlist's tail. <10, 1, 5>
  node = new Node(5);
  linkedList.addLast(node);
  cout << "linkedList.getFirst()->getValue() = " << linkedList.getFirst()->getValue() << endl;
  cout << "linkedList.getLast()->getValue() = " << linkedList.getLast()->getValue() << endl;
 
 //Add a Node, which value is 2 to linkedlist's tail. <10, 1, 5, 2>
  node = new Node(2);
  linkedList.addLast(node);
  cout << "linkedList.getFirst()->getValue() = " << linkedList.getFirst()->getValue() << endl;
  cout << "linkedList.getLast()->getValue() = " << linkedList.getLast()->getValue() << endl;

  //Remove head <1, 5, 2>
  linkedList.removeFirst();
  cout << "linkedList.getFirst()->getValue() = " << linkedList.getFirst()->getValue() << endl;
  cout << "linkedList.getLast()->getValue() = " << linkedList.getLast()->getValue() << endl;

  //Remove last <1, 5>
  linkedList.removeLast();
  cout << "linkedList.getFirst()->getValue() = " << linkedList.getFirst()->getValue() << endl;
  cout << "linkedList.getLast()->getValue() = " << linkedList.getLast()->getValue() << endl;


  return 0;
}
